fix locking in cpu_disable_scheduler()
authorJan Beulich <jbeulich@suse.com>
Tue, 29 Oct 2013 08:57:14 +0000 (09:57 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 29 Oct 2013 08:57:14 +0000 (09:57 +0100)
commit41a0cc9e26160a89245c9ba3233e3f70bf9cd4b4
treed5a8c37ada11011a45f037a84c57b22d4b95859f
parentc9efe34c119418a5ac776e5d91aeefcce4576518
fix locking in cpu_disable_scheduler()

So commit eedd6039 ("scheduler: adjust internal locking interface")
uncovered - by now using proper spin lock constructs - a bug after all:
When bringing down a CPU, cpu_disable_scheduler() gets called with
interrupts disabled, and hence the use of vcpu_schedule_lock_irq() was
never really correct (i.e. the caller ended up with interrupts enabled
despite having disabled them explicitly).

Fixing this however surfaced another problem: The call path
vcpu_migrate() -> evtchn_move_pirqs() wants to acquire the event lock,
which however is a non-IRQ-safe once, and hence check_lock() doesn't
like this lock to be acquired when interrupts are already off. As we're
in stop-machine context here, getting things wrong wrt interrupt state
management during lock acquire/release is out of question though, so
the simple solution to this appears to be to just suppress spin lock
debugging for the period of time while the stop machine callback gets
run.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/common/schedule.c
xen/common/stop_machine.c